package com.sren.boot.service;

import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;

import java.util.stream.Stream;

/**
 * @author: renshuai
 * @date: 2019/11/25 上午9:20
 * @Description: lambda实现
 */
@Service
@Profile("java8")
public class Java8CalculateService implements CalculateService {
	@Override
	public Integer sum(Integer... values) {
		System.out.println("java8 lambda 实现");
		Integer sum = Stream.of(values).reduce(0, Integer::sum);
		return sum;
	}
}
